#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QMouseEvent>
#include <QStyle>
#include <QPushButton>
#include <QStackedWidget>
#include <QStatusBar>
#include <QLabel>

class im;
class mm;
class sm;

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    MainWindow(const QMap<QString, QVariant> &userInfo, QWidget *parent = nullptr);
    ~MainWindow();



    // 添加获取当前用户信息的方法
    QMap<QString, QVariant> getCurrentUser() const;

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseDoubleClickEvent(QMouseEvent *event) override;

private slots:
    void onMinimizeButtonClicked();
    void onMaximizeRestoreButtonClicked();
    void onCloseButtonClicked();

private:
    QPushButton *m_maximizeRestoreButton;  // 修正：确保这是成员变量
    void initUI();
    bool m_bDragging;
    QPoint m_StartPos;
    QPoint m_WindowPos;
    QWidget *m_titleBar;
    QStackedWidget *m_stackedWidget;
    QStatusBar *m_statusBar;
    QWidget *m_contentWidget;  // 新增：保存内容窗口指针
     QLabel *m_timeLabel;

    // 三大子页面
    im *m_imanage;
    mm *m_mmanage;
    sm *m_smanage;

private:
    // 新增函数声明
    void updateTimeDisplay();
    QString getLunarDate(const QDate &date);
    QMap<QString, QVariant> m_currentUser; // 新增：存储当前用户信息
};

#endif // MAINWINDOW_H
